def append(list1, list2):
    return list1 + list2


def concat(lists):
    final = []
    for item in lists:
        final += item
    return final


def filter(function, list):
    return [value for value in list if function(value)]


def length(list):
    return len(list)


def map(function, list):
    return [function(value) for value in list]


def foldl(function, list, initial):
    for value in list:
        initial = function(initial, value)
    return initial


def foldr(function, list, initial):
    return foldl(function, reverse(list), initial)


def reverse(list_param):
    return list(reversed(list_param))
